package com.ceshiren.springstudy.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class JDBCConfig {

    @Value("${jdbc.driver}")
    private String driver;
    @Value("${jdbc.url}")
    private String url;
    @Value("${jdbc.username:root}")
    private String username;
    @Value("${jdbc.password:pasword123}")
    private String password;

    @Bean
    public Map<String,String> getJDBCConfig() {
        Map<String,String> config = new HashMap<String,String>();
        config.put("driver", driver);
        config.put("url", url);
        config.put("user", username);
        config.put("password", password);
        return config;
    }
}
